<?php

/**
 * CargoPayment filter form base class.
 *
 * @package    symfony
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCargoPaymentFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cargo_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cargo'), 'add_empty' => true)),
      'tatvar'                => new sfWidgetFormFilterInput(),
      'teewerleltzardal'      => new sfWidgetFormFilterInput(),
      'mongolia_gaalitatvar'  => new sfWidgetFormFilterInput(),
      'mongolia_hurtolzardal' => new sfWidgetFormFilterInput(),
      'payment_date'          => new sfWidgetFormFilterInput(),
      'create_at'             => new sfWidgetFormFilterInput(),
      'update_at'             => new sfWidgetFormFilterInput(),
      'enabled'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'cargo_id'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Cargo'), 'column' => 'id')),
      'tatvar'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'teewerleltzardal'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'mongolia_gaalitatvar'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'mongolia_hurtolzardal' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'payment_date'          => new sfValidatorPass(array('required' => false)),
      'create_at'             => new sfValidatorPass(array('required' => false)),
      'update_at'             => new sfValidatorPass(array('required' => false)),
      'enabled'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('cargo_payment_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CargoPayment';
  }

  public function getFields()
  {
    return array(
      'id'                    => 'Number',
      'cargo_id'              => 'ForeignKey',
      'tatvar'                => 'Number',
      'teewerleltzardal'      => 'Number',
      'mongolia_gaalitatvar'  => 'Number',
      'mongolia_hurtolzardal' => 'Number',
      'payment_date'          => 'Text',
      'create_at'             => 'Text',
      'update_at'             => 'Text',
      'enabled'               => 'Boolean',
    );
  }
}
